import sys
import clr
privpath="C:\\Programmer\\Microsoft Visual Studio 10.0\\Common7\\IDE\\PrivateAssemblies"

sys.path.append(privpath)


clr.AddReferenceByPartialName("Microsoft.TeamFoundation")
clr.AddReferenceByPartialName("Microsoft.TeamFoundation.Common")
clr.AddReferenceByPartialName("Microsoft.TeamFoundation.Client")
clr.AddReferenceToFile("Microsoft.TeamFoundation.WorkItemTracking.Controls.dll")

from Microsoft.TeamFoundation.Server import *
from Microsoft.TeamFoundation.Proxy import *
from Microsoft.TeamFoundation.Client import *
from Microsoft.TeamFoundation.WorkItemTracking.Controls import *

tfs = TeamFoundationServerFactory.GetServer(serverurl)

wis = tfs.GetService(WorkItemStore)

for p in wis.Projects: 
  print p.Name



